package com.atguigu.spzx.utils;

import com.atguigu.spzx.model.entity.system.SysUser;

/**
 * @author wx
 * @version 1.0
 * @description: TODO
 * @date 2024/11/7 10:19
 */
public class AuthContextUtil {
    //创建ThreadLocal对象
    private static final ThreadLocal<SysUser> threadLocal = new ThreadLocal<>();

    //定义存储数据的静态方法
    public static SysUser get() {
        return threadLocal.get();
    }

    public static void set(SysUser sysUser) {
        threadLocal.set(sysUser);
    }

    public static void remove() {
        threadLocal.remove();
    }
}
